﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;

namespace MovieDB
{
    public class MdbConnect
    {
        public static IPlugin GetPlugInObject()
        {
            MoviePosterDBPlugin plugin = new MoviePosterDBPlugin();
            return plugin;
        }

        public static void LoadPoster(CheckedListBox.ObjectCollection movieList)
        {
            //CheckedListBox.ObjectCollection movieList = (CheckedListBox.ObjectCollection)parameters[0];
            MoviePosterDBPlugin mpdb = new MoviePosterDBPlugin();
            //string dbPath = (string)parameters[0];

            foreach (object item in movieList)
            {
                MpdbImages list = null;
                MovieDB.MdbMovie movie = (MovieDB.MdbMovie)item;

                if (movie.Current != null)
                {
                    list = mpdb.GetImageList(movie.Current.ImdbId);
                }

                for (int i = 0; i < list.ImageList.Count; i++)
                {
                    list.ImageList[i].Save("C:\\tmpTest" + list.ImageNames);
                }
            }
        }


    }
}
